import axios from '../axiosAPI'
export default {
    // 获取商品分类列表
    getCateList(queryInfo) {
        return axios.get('categories', { params: queryInfo })
    },
    // 添加商品分类
    addCate(CateForm) {
        return axios.get('categories', CateForm)
    },
    // 查询商品分类
    queryCate(id) {
        return axios.get(`categories/${id}`)
    },
    // 编辑商品分类
    updataCate(id) {
        return axios.put(`categories/${id}`)
    },
    // 删除分类
    deleteCate(id) {
        return axios.delete(`categories/${id}`)
    },
    //获取参数列表
    getParamsList(id, sel) {
        return axios.get(`categories/${id}/attributes`, { params: sel })
    },
    //添加动态参数/静态属性
    addParams(id, attrName, activeName) {
        return axios.post(`categories/${id}/attributes`, {
            attr_name: attrName,
            attr_sel: activeName
        })
    },
    //根据 ID 查询参数
    searchParams(id, attrid) {
        return axios.get(`categories/${id}/attributes/${attrid}`)
    },
    // 编辑提交参数
    updataParams(id, attrid) {
        return axios.put(`categories/${id}/attributes/${attrid}`)
    },
    //删除参数
    deleteParams(id, attrid) {
        return axios.delete(`categories/${id}/attributes/${attrid}`,)
    },
    //商品列表数据
    getGoodsList(queryInfo) {
        return axios.get('goods',{params:queryInfo})
    },
    //添加商品
    addGoods(goodsList) {
        return axios.post('goods', goodsList)
    },
    //根据 ID 查询商品
    searchGoods(id) {
        return axios.get(`goods/${id}`)
    },
    //编辑提交商品
    updataGoods(id,updataGoodsList) {
        return axios.put(`goods/${id}`,updataGoodsList)
    },
    //删除商品
    deleteGoods(id) {
        return axios.delete(`goods/${id}`)
    }
}